﻿@using ZDSoft.LMS.Domain;
@model IEnumerable<DeliveryForm>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/Style/ViewPage.css")" rel="stylesheet" type="text/css" />
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; background-color: White;"
    align="center">
    <tr>
        <td class="mbg">
            <table cellspacing="0" cellpadding="0" width="100%" border="0" valign="top">
                <tr>
                    <td>
                        <table style="height: 23px;" cellspacing="0" cellpadding="0" width="120" background="@Url.Content("~/Content/Images/m_17.gif")"
                            border="0">
                            <tr>
                                <td>
                                    <span class="contentPageTitle">&nbsp;&gt;&gt; 回车登记</span>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" class="titleContentDivider" height="6">
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<p>
    &nbsp;
</p>
<table cellpadding="0" cellspacing="0" class="dataGrid">
    <tr>
        <th rowspan="2">
            送货员
        </th>
        <th rowspan="2">
            运输车辆
        </th>
        <th rowspan="2">
            发站
        </th>
        <th rowspan="2">
            到站(局)
        </th>
        <th colspan="3" style="border-left: 1px solid #007ea2; border-right: 1px solid #007ea2;">
            托运人
        </th>
        <th colspan="3" style="border-right: 1px solid #007ea2;">
            收货人
        </th>
        <th rowspan="2">
            状态
        </th>
        <th rowspan="2">
            操作
        </th>
    </tr>
    <tr>
        <th style="border-left: 1px solid #007ea2;">
            姓名
        </th>
        <th>
            电话
        </th>
        <th style="border-right: 1px solid #007ea2;">
            地址
        </th>
        <th>
            姓名
        </th>
        <th>
            电话
        </th>
        <th style="border-right: 1px solid #007ea2;">
            地址
        </th>
    </tr>
    @if (Model == null || Model.Count() == 0)
    { 
        <tr>
            <td colspan="12">
                没有满足条件的记录!
            </td>
        </tr>
    }
    else
    {
        foreach (var item in Model)
        {
        <tr>
            <td>
                @item.Transporter.UserName
            </td>
            <td>
                @item.Vehicle.VehicleNumber
            </td>
            <td>
                @item.TransportOrder.StartStation
            </td>
            <td>
                @item.TransportOrder.Destionation
            </td>
            <td>
                @item.TransportOrder.Commisionedor.Name
            </td>
            <td>
                @item.TransportOrder.Commisionedor.Telephone
            </td>
            <td>
                @item.TransportOrder.Commisionedor.Address
            </td>
            <td>
                @item.TransportOrder.Receiver.Name
            </td>
            <td>
                @item.TransportOrder.Receiver.Telephone
            </td>
            <td>
                @item.TransportOrder.Receiver.Address
            </td>
            <td>
                @{var status = string.Empty;
                  switch (item.TransportOrder.Status)
                  {
                      case (TransportOrderStatus.WaitingForDispatch):
                          {
                              status = "等待调度";
                              break;
                          }
                      case (TransportOrderStatus.Delivering):
                          {
                              status = "运输中"; break;
                          }
                      case (TransportOrderStatus.Done):
                          {
                              status = "完成"; break;
                          }
                      default: { break; }
                  }
                    <span>@status</span>
                }
            </td>
            <td>
                @Html.ActionLink("报销费用", "Create", new { id = item.ID })|
                @Html.ActionLink("详细信息", "Details/" + item.TransportOrder.ID, "TransportOrder")
            </td>
        </tr>
        }
    }
</table>

